/**
 * FixedRedBlueColourSchemeTest.java
 * colourmap
 * Copyright (C) 2010 Alan W.F. Boyd
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * You can contact the author via the google code web page for the project
 * <http://colourmap.googlecode.com>
 */
package com.googlecode.colourmap.unittests;

import static org.junit.Assert.*;

import java.awt.Color;

import org.junit.Before;
import org.junit.Test;

import com.googlecode.colourmap.colours.FixedRedBlueColourScheme;


/**
 * This class takes care of unit testing the FixedRedBlueColourScheme class
 * @author Alan W.F. Boyd
 *
 */
public class FixedRedBlueColourSchemeTest
{
	private FixedRedBlueColourScheme colourScheme;
	
	/**
	 * Before the tests are run, the RadialInterpolator object is created
	 */
	@Before 
	public void beforeTests()
	{
		colourScheme = new FixedRedBlueColourScheme();
	}
	
	/**
	 * Checks whether the getColour method returns blue (0, 0, 255) if the supplied value is less than 200
	 * Test method for {@link com.googlecode.colourmap.colours.UserDefinedColourScheme#getColour(float)}.
	 */
	@Test
	public void testGetColourBelowMin()
	{
		assertEquals(colourScheme.getColour(100), new Color(0, 0, 255));
	}
	
	/**
	 * Checks whether the getColour method returns blue (0, 0, 255) if the supplied value is equal to 200
	 * Test method for {@link com.googlecode.colourmap.colours.UserDefinedColourScheme#getColour(float)}.
	 */
	@Test
	public void testGetColourEqualMin()
	{
		assertEquals(colourScheme.getColour(200), new Color(0, 0, 255));
	}
	
	/**
	 * Checks whether the getColour method returns red (255, 0, 0) if the supplied value is greater than 400
	 * Test method for {@link com.googlecode.colourmap.colours.UserDefinedColourScheme#getColour(float)}.
	 */
	@Test
	public void testGetColourAboveMax()
	{
		assertEquals(colourScheme.getColour(800), new Color(255, 0, 0));
	}
	
	/**
	 * Checks whether the getColour method returns red (255, 0, 0) if the supplied value is equal to 400
	 * Test method for {@link com.googlecode.colourmap.colours.UserDefinedColourScheme#getColour(float)}.
	 */
	@Test
	public void testGetColourEqualMax()
	{
		assertEquals(colourScheme.getColour(400), new Color(255, 0, 0));
	}
	
	/**
	 * Checks whether the getColour method returns green (0, 255, 0) if the supplied value is equal to 300 (i.e. midway between red/blue or 200/400)
	 * Test method for {@link com.googlecode.colourmap.colours.UserDefinedColourScheme#getColour(float)}.
	 */
	@Test
	public void testGetColourMidway()
	{
		assertEquals(colourScheme.getColour(300), new Color(0, 255, 0));
	}
	
	/**
	 * Checks whether the getColour method returns blue (0, 0, 255) if the supplied value is negative (still below 400)
	 * Test method for {@link com.googlecode.colourmap.colours.UserDefinedColourScheme#getColour(float)}.
	 */
	@Test
	public void testGetColourNegative()
	{
		assertEquals(colourScheme.getColour(-1), new Color(0, 0, 255));
	}
	
	/**
	 * Checks whether the getColour method returns blue (0, 0, 255) if the supplied value is zero (still below 400)
	 * Test method for {@link com.googlecode.colourmap.colours.UserDefinedColourScheme#getColour(float)}.
	 */
	@Test
	public void testGetColourZero()
	{
		assertEquals(colourScheme.getColour(0), new Color(0, 0, 255));
	}
	
	/**
	 * Checks whether the getColour method returns red (255, 0, 0) if the supplied value is Float.MAX (still above 500)
	 * Test method for {@link com.googlecode.colourmap.colours.UserDefinedColourScheme#getColour(float)}.
	 */
	@Test
	public void testGetColourFloatMax()
	{
		assertEquals(colourScheme.getColour(Float.MAX_VALUE), new Color(255, 0, 0));
	}
}
